# -*- coding:utf-8 -*-

"""
5-16 家庭财务。给定一个初始金额和月开销数， 使用循环，确定剩下的金额和当月的支
出数， 包括最后的支出数。 Payment() 函数会用到初始金额和月额度， 输出结果应该类似下
面的格式（例子中的数字仅用于演示）：
Enter opening balance:100.00                                                          
Enter monthly payment: 16.13
Amount Remaining
Pymt# Paid Balance
----- ------ ---------
0 $ 0.00 $100.00
1 $16.13 $ 83.87
2 $16.13 $ 67.74
3 $16.13 $ 51.61
4 $16.13 $ 35.48
5 $16.13 $ 19.35
6 $16.13 $ 3.22
7 $ 3.22 $ 0.00
"""

def payment(balance,paymonth):
	number = 0
	print "Pymt#\tPaid\tBalance"
	print "%s\t$%.2f\t$%.2f"%(number,0,balance)
	while balance > 0:
		if balance > paymonth:
			balance -= paymonth
			number+=1 
			print "%s\t$%.2f\t$%.2f"%(number,paymonth,balance)
		else:
			paymonth=balance
			balance = 0
			number += 1
			print "%s\t$%.2f\t$%.2f"%(number,paymonth,balance)

if __name__ == "__main__":
	balance = float(raw_input("Balance:>>"))	
	paymonth = float(raw_input("Paymonth:>>"))
	payment(balance,paymonth)
	